package com.da.common.utils;

import com.da.common.enums.ResultEnum;
import lombok.Data;

/**
 * @Author: hyacinth
 * @CreateTime: 2025-01-10
 * @Version: 1.0
 */
@Data
public class DailyAimResult<T> {
    private int code;       // 状态码
    private String msg;      // 返回消息
    private T data;          // 返回数据

    public DailyAimResult() {
    }

    public DailyAimResult(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static <T> DailyAimResult<T> success(T data) {
        DailyAimResult<T> dailyAimResult = new DailyAimResult<T>();
        dailyAimResult.setCode(ResultEnum.SUCCESS.getCode());
        dailyAimResult.setMsg(ResultEnum.SUCCESS.getMessage());
        dailyAimResult.setData(data);
        return dailyAimResult;
    }

    public static <T> DailyAimResult<T> success(String msg, T data) {
        DailyAimResult<T> dailyAimResult = new DailyAimResult<T>();
        dailyAimResult.setCode(ResultEnum.SUCCESS.getCode());
        dailyAimResult.setMsg(msg);
        dailyAimResult.setData(data);
        return dailyAimResult;
    }
    public static <T> DailyAimResult<T> success(int code, String msg, T data) {
        DailyAimResult<T> dailyAimResult = new DailyAimResult<T>();
        dailyAimResult.setCode(code);
        dailyAimResult.setMsg(msg);
        dailyAimResult.setData(data);
        return dailyAimResult;
    }
    public static <T> DailyAimResult<T> success(int code, String msg) {
        DailyAimResult<T> dailyAimResult = new DailyAimResult<T>();
        dailyAimResult.setCode(code);
        dailyAimResult.setMsg(msg);
        dailyAimResult.setData(null);
        return dailyAimResult;
    }

    public static <T> DailyAimResult<T> success() {
        DailyAimResult<T> dailyAimResult = new DailyAimResult<T>();
        dailyAimResult.setCode(ResultEnum.SUCCESS.getCode());
        dailyAimResult.setMsg(ResultEnum.SUCCESS.getMessage());
        dailyAimResult.setData(null);
        return dailyAimResult;
    }

    public static <T> DailyAimResult<T> error() {
        DailyAimResult<T> dailyAimResult = new DailyAimResult<T>();
        dailyAimResult.setCode(ResultEnum.FAIL.getCode());
        dailyAimResult.setMsg(ResultEnum.SUCCESS.getMessage());
        dailyAimResult.setData(null);
        return dailyAimResult;
    }
    public static <T> DailyAimResult<T> error(String msg) {
        DailyAimResult<T> dailyAimResult = new DailyAimResult<T>();
        dailyAimResult.setCode(ResultEnum.FAIL.getCode());
        dailyAimResult.setMsg(msg);
        dailyAimResult.setData(null);
        return dailyAimResult;
    }

    public static <T> DailyAimResult<T> error(int code, String msg) {
        DailyAimResult<T> dailyAimResult = new DailyAimResult<T>();
        dailyAimResult.setCode(code);
        dailyAimResult.setMsg(msg);
        dailyAimResult.setData(null);
        return dailyAimResult;
    }


}
